"""首页"""
from page.base_page import BasePage
from selenium.webdriver.common.by import By

class IndexPage(BasePage):
    url="/crm5/index.php?m=dynamic&a=index"
    #定位器
    # 个人头像定位器
    btn_profile_picture_locator = (By.CSS_SELECTOR,
                                   "body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul.nav.pull-right > li:nth-child(6)")
    # 组织架构定位器
    organizational_locator = (By.LINK_TEXT, '组织架构')
    # 个人资料定位器
    btn_personal_locator = (By.LINK_TEXT, '个人资料')
    # 系统设置定位器
    sys_set_locator = (By.LINK_TEXT, "系统设置")
    #任务定位器
    task_locator = (By.LINK_TEXT, "任务")
    #产品定位器
    product_locator = (By.CSS_SELECTOR,"body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul:nth-child(1) > li:nth-child(4) > a")
    #日志定位器
    btn_more_locator = (By.CSS_SELECTOR, "body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul:nth-child(1) > li.dropdown > a")
    log_locator = (By.LINK_TEXT, "日志")
    def click_profile(self):
        """点击个人头像的方法"""
        self.driver.find_element(*self.btn_profile_picture_locator).click()
    def click_organization(self):
        """点击组织架构的方法"""
        self.driver.find_element(*self.organizational_locator).click()
    def click_btn_personal(self):
        """点击个人资料"""
        self.driver.find_element(*self.btn_personal_locator).click()
    def click_sys_set(self):
        """点击系统设置"""
        self.driver.find_element(*self.sys_set_locator).click()
    def click_task(self):
        """点击任务"""
        self.driver.find_element(*self.task_locator).click()#跳转至任务页面
    def click_product(self):
        """点击产品"""
        self.driver.find_element(*self.product_locator).click()#跳转至产品页面
    def click_btn_more(self):
        """点击更多"""
        self.driver.find_element(*self.btn_more_locator).click()#点击更多
    def click_log(self):
        """点击日志"""
        self.driver.find_element(*self.log_locator).click()#跳转至日志页面

